package bma.common.langutil.ai.vm;

public class AIContextVM implements AIContext {

	protected final AIVM vm;
	protected final Object router;

	public AIContextVM(AIVM vm, Object router) {
		super();
		this.vm = vm;
		this.router = router;
	}

	public static AIContext create(Object router) {
		AIVM vm = AIVM.current();
		return vm == null ? null : new AIContextVM(vm, router);
	}

	@Override
	public void execute(Runnable command) {
		vm.execute(router, command);
	}
}
